//
//  AgreenBtnView.swift
//  旅航ios
//
//  Created by tulip on 2021/6/11.
//

import UIKit

class AgreenBtnView: UIView {
    
    var agreenBtn:UIButton!
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        agreenBtn=UIButton.init(frame: CGRect(x: 17, y: 0, width: 70, height: 20))
        agreenBtn.setTitle("同意", for: .normal)
        agreenBtn.titleLabel?.font=UIFont.systemFont(ofSize: 12)
        agreenBtn.setTitleColor(UIColor.init(hexString: "666666"), for: .normal)
        agreenBtn.setImage(UIImage(named: "未勾选"), for: .normal)
        agreenBtn.setImage(UIImage(named: "同意"), for: .selected)
        agreenBtn.addTarget(self, action: #selector(agree), for: .touchUpInside)
        agreenBtn.titleEdgeInsets=UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 0)
        self.addSubview(agreenBtn)
        
        let xieyi=UIButton.init(frame: CGRect(x: agreenBtn.frame.size.width+agreenBtn.frame.origin.x+10, y: 0, width: 100, height: 20))
        xieyi.setTitle("《用户服务协议》", for: .normal)
        xieyi.titleLabel?.font=UIFont.systemFont(ofSize: 12)
        xieyi.setTitleColor(UIColor.init(hexString: "3e7dff"), for: .normal)
        xieyi.addTarget(self, action: #selector(xieyiVC), for: .touchUpInside)
        self.addSubview(xieyi)
        
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    @objc func agree(sender:UIButton){
        sender.isSelected = !sender.isSelected
    }
    
    
    @objc func xieyiVC(){
        
    }
}
